Fix #49 and #51, might have performance implications #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An attempt to fix #49 and #51
The problem (I think) was that the MutationObserver is somehow interfering with the keyboard space key event. Since the MutationObserver was applied on
$(#message_container)
s, in Threads view, this also included the input text field attached to each thread.In this pull request, I resorted to using DOMNodeInserted event, which doesn't seem to cause trouble with keyboard (though according to internet this should be deprecated for performance reason). As a compensation (I hope), in the event handler, I only attached IntersectionObserver which watches for DOM entry, and then mathjax the relevant pieces of text (instead of the entire message container as before).
Edit:
Just realized that https://github.com/thisiscam/math-with-slack/blob/v3/math-with-slack.py#L184 also hacks away the problem of Slack rewriting the local settings file.
Hacky but one-liner is always worth it 💯